(function(lib,config){
	/*
    config = {
        dotname: '男科张医生',
        typeid: '1',// 弹窗类型 1=固定 2=全屏 3=锚点(保留)
        words: '话术1|话术2|话术3',
        bgcolor: '#ab2626|#333333',
        textcolor: '#9e3636|#ffffff',
        imglink: '/upload/20180521/201805211045251799.png|/upload/20180521/201805211045251799.png',
        weblink: '',// 商务通链接
        flashid: '0',// 保留
        positionid: '5',// 位置 当typeif=1时有效 (将屏幕分割成九宫格)取值：1~9 1=左上 2=左中 3=左右 4=中左 5=中中 6=中右 7=下左 8=下中 9=下右
        firsttime: '10',// 首次弹出时间 单位：秒 
        relapsetime: '30',// 普通弹出时间 单位：秒 0=关闭
        eachtime: '20', // 弹出后显示时间 单位：秒
        iscomapp: '1', //是否兼容百度 0=否 1=是
        identifier: 'centerswt'// 进入商务通的标识符
    };
    */
	/* words bgcolor textcolor imglink 可能有多个，用管道符号 | 分割*/
	var loadFunc=function(){
		var textAry=config.words.split('|'),bgcolorAry=config.bgcolor.split('|'),textcolorAry=config.textcolor.split('|'),imglinkAry=config.imglink.split('|');
		imglinkAry[0]=imglinkAry[0]||'http://yuyue.hxtg.org/attachment/zjtx.jpg';
		imglinkAry[1]=imglinkAry[2]||'http://yuyue.hxtg.org/attachment/db-p1.jpg';
		textAry[0]=textAry[0]||'男科主任张医生';
		textAry[1]=textAry[1]||'你好，我是王祖祥，你是想问';
		textAry[2]=textAry[2]||'男科';
		textAry[3]=textAry[3]||'相关问题吗？';
		textAry[4]=textAry[4]||'我从事男科临床诊疗30多年，治愈了很多与';
		textAry[5]=textAry[5]||'男科';
		textAry[6]=textAry[6]||'相关的疾病，相信一定能帮助到你的，请问你现在有什么症状吗？';
		textcolorAry[0]=textcolorAry[0]||'#d6601b';
		textcolorAry[1]=textcolorAry[1]||'#8c5605';
		textcolorAry[2]=textcolorAry[2]||'#ff0000';
		textcolorAry[3]=textcolorAry[3]||'#8c5605';
		textcolorAry[4]=textcolorAry[4]||'#8c5605';
		textcolorAry[5]=textcolorAry[5]||'#ff0000';
		textcolorAry[6]=textcolorAry[6]||'#8c5605';
		/*TODO 方法*/
		function getScrollTop(){ 
	var scrollTop=0;
	if(document.documentElement&&document.documentElement.scrollTop)
	{
		scrollTop=document.documentElement.scrollTop;
	}
	else if(document.body)
	{
		scrollTop=document.body.scrollTop;
	}
	return scrollTop;
}
function getClientHeight(){
	var clientHeight=0;
	if(document.body.clientHeight&&document.documentElement.clientHeight)
	{
		var clientHeight = (document.body.clientHeight<document.documentElement.clientHeight)?document.body.clientHeight:document.documentElement.clientHeight;        
	}
	else
	{
		var clientHeight = (document.body.clientHeight>document.documentElement.clientHeight)?document.body.clientHeight:document.documentElement.clientHeight;    
	}
	return clientHeight;
}

var _ua = navigator.userAgent,_ua_text = false,_position = "fixed"; 
if(_ua.indexOf('baiduboxapp')>-1){
	_ua_text = true;_position = "absolute";
}

var dotpic=imglinkAry[0];
var dotname=textAry[0];
function GetQueryString($name){
    var $index=document.referrer.indexOf($name+"="),$e='';
    if($index>1){
        $e=document.referrer.substring($index+$name.length+1);
        if(($index=$e.indexOf("&"))>0){
            $e=$e.substring(0,$index);
        }
    }
    return $e;
}
// 调用方法
var $wd=GetQueryString("wd");
if($wd&&$wd.length>0){}else{$wd=GetQueryString("word")}
if($wd&&$wd.length>0){
    $wd=decodeURIComponent($wd);
    str1='<p>'+textAry[1]+'<font color="'+textcolorAry[2]+'">【“'+$wd+'”】</font>'+textAry[3]+'</p>';
	str2 = '<p>'+textAry[4]+'<font color="'+textcolorAry[5]+'">【“'+$wd+'”】</font>'+textAry[6]+'</p>';
}else{
    str1='<p>'+textAry[1]+'<font color="'+textcolorAry[2]+'">'+textAry[2]+'</font>'+textAry[3]+'</p>';
	str2 = '<p>'+textAry[4]+'<font color="'+textcolorAry[5]+'">'+textAry[5]+'</font>'+textAry[6]+'</p>';
}
var htmlStr=[
"<style type=\"text/css\">",
"#LR-BUBBLE{ margin:0 5% 5% 5% !important;border-radius:10px;background-color:{{bgcolor}} !important;border:1px solid #38b8f5; }#LR-BUBBLE-NAME{ color:#6D5220;font-weight:bold;}#LR-BUBBLE-MSG{ color:{{textcolor2}}; font-weight:bold;height: auto !important;}#LR-BUBBLE-MSG img{ width:32px; height:32px;}",
"#LR-BUBBLE { -webkit-animation: shake-little 10s both infinite; -moz-animation: shake-little 10s both infinite; -ms-animation: shake-little 10s both infinite; animation: shake-little 10s both infinite; }",
".footcss {z-index: 999999999999999999 !important;position: relative !important;}",
"@-webkit-keyframes shake-little { 0, 20% {",
" -webkit-transform: translate(0px, 0px) rotate(0deg)",
"}",
"21% {",
" -webkit-transform: translate(0px, 0px) rotate(0deg)",
"}",
"21.3% {",
" -webkit-transform: translate(-2px, 2px) rotate(0.5deg)",
"}",
"21.6% {",
" -webkit-transform: translate(0px, 0px) rotate(0deg)",
"}",
"22% {",
" -webkit-transform: translate(2px, -2px) rotate(-0.5deg)",
"}",
"22.3% {",
" -webkit-transform: translate(0px, 0px) rotate(0deg)",
"}",
"22.6% {",
" -webkit-transform: translate(-2px, 2px) rotate(0.5deg)",
"}",
"23% {",
" -webkit-transform: translate(0px, 0px) rotate(0deg)",
"}",
"23.3% {",
" -webkit-transform: translate(2px, -2px) rotate(-0.5deg)",
"}",
"23.6% {",
" -webkit-transform: translate(0px, 0px) rotate(0deg)",
"}",
"24% {",
" -webkit-transform: translate(2px, -2px) rotate(-0.5deg)",
"}",
"24.3%, 100% {",
" -webkit-transform: translate(0px, 0px) rotate(0deg)",
"}",
"}",
"</style>",

"<style type=\"text/css\">#LR-BUBBLE{ position:"+ _position +"; right: 0;  display: none; width: 90%; margin: 0 5%; background-color:#fff7e4; color: #000; text-align: left; box-shadow: 0 5px 16px 0 rgba(0, 0, 0, .16);  border-radius:10px; z-index: 998; }#LR-BUBBLE-INSIDE{ text-align: left; line-height:20px; height:auto;padding:5px;margin:0;}.LR-ICONs { background-size: 26px auto !important; background-repeat: no-repeat !important; background-image: url(http://nanke.lzcj120.com/swt/swt20180516/img/gb.png) !important; }#LR-BUBBLE-CLOSE { position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; background-position: 0px 0px !important; -webkit-filter: brightness(0.6); }#LR-BUBBLE-MSG { height: auto !important; font-size: 14px; overflow: hidden; color: #520606 !important;margin:0; }#LR-BUBBLE-MSG p{ padding:0; margin:5px 0; line-height:20px; width: 84%; font-size: 1em; line-height:1.2em; }#LR-BUBBLE-MSG p img { width:20px; height:20px;}#LR-BUBBLE-NAME { font-weight: bold; color: {{textcolor1}} !important; font-size: 16px; }#LR-BUBBLE-title{ width: 100%; height:auto !important;line-height:24px;overflow: visible;}#LR-BUBBLE-AVATAR { width: 36px; height: 36px; float: left; border-radius: 18px; margin-right: 6px; vertical-align: top; box-shadow: 0 0 8px 0 rgba(0, 0, 0, .15); }.footerdh{width:100%; height:38px; }.footerdh img {width:100%; height:38px;border-radius:0 0 10px 10px;}<\/style>",
"<style type=\"text/css\">#LR-BUBBLE{ position:"+ _position +"; right: 0;  display: none; width: 90%; margin: 0 5%; background-color:#fff7e4; color: #000; text-align: left; box-shadow: 0 5px 16px 0 rgba(0, 0, 0, .16);  border-radius:10px; z-index: 998; }#LR-BUBBLE-INSIDE{ text-align: left; line-height:20px; height:auto;padding:5px;margin:0;}.LR-ICONs { background-size: 26px auto !important; background-repeat: no-repeat !important; background-image: url(http://nanke.lzcj120.com/swt/swt20180516/img/gb.png) !important; }#LR-BUBBLE-CLOSE { position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; background-position: 0px 0px !important; -webkit-filter: brightness(0.6); }#LR-BUBBLE-MSG { height: auto !important; font-size: 14px; overflow: hidden; color: #520606 !important;margin:0; }#LR-BUBBLE-MSG p{ padding:0; margin:5px 0; line-height:20px; width: 84%; font-size: 1em; line-height:1.2em; }#LR-BUBBLE-MSG p img { width:20px; height:20px;}#LR-BUBBLE-NAME { font-weight: bold; color: {{textcolor1}} !important; font-size: 16px; }#LR-BUBBLE-title{ width: 100%; height:auto !important;line-height:24px;overflow: visible;}#LR-BUBBLE-AVATAR { width: 36px; height: 36px; float: left; border-radius: 18px; margin-right: 6px; vertical-align: top; box-shadow: 0 0 8px 0 rgba(0, 0, 0, .15); }.footerdh{width:100%; height:38px; }.footerdh img {width:100%; height:38px;border-radius:0 0 10px 10px;}<\/style>",
"<div id=\"LR-BUBBLE\" style=\"top:40%\"><span class=\"LR-ICONs\" id=\"LR-BUBBLE-CLOSE\" onclick=\"closebar();\"></span><div id=\'LR-BUBBLE-INSIDE\' onclick='openZoosUrl(\"\",\"&e=fkswt_center\");'></div><div class=\"footerdh\" onclick='openZoosUrl(\"\",\"&e=fkswt_center\");'><img src=\"http://yuyue.hxtg.org/attachment/images/footerhh.gif\"/><\/div><\/div>"
].join('');
htmlStr=lib.util.resolveTemplate(htmlStr,'textcolor1',textcolorAry[0],'textcolor2',textcolorAry[1]);
document.body.innerHTML+=htmlStr;

function toolkey() {
    document.getElementById('LR-BUBBLE').style.display = 'block';
    document.getElementById('LR-BUBBLE-INSIDE').innerHTML = "<div id=\'LR-BUBBLE-title\' style=\'display: block;\'><img id=\'LR-BUBBLE-AVATAR\' src=\'"+dotpic+"\'><span id=\'LR-BUBBLE-NAME\'>"+dotname+"</span></div><div id=\'LR-BUBBLE-MSG\'>" + str1 + "</div>";
    setTimeout(toolkey2, 3000);
};
function toolkey2() {
    document.getElementById('LR-BUBBLE-INSIDE').innerHTML = "<div id=\'LR-BUBBLE-title\' style=\'display: block;\'><img id=\'LR-BUBBLE-AVATAR\' src=\'"+dotpic+"\'><span id=\'LR-BUBBLE-NAME\'>"+dotname+"</span></div><div id=\'LR-BUBBLE-MSG\'>" + str2 + "</div>";
};
setTimeout(toolkey, 3000);
function closebar() {
    document.getElementById('LR-BUBBLE').style.display = 'none';
    //setTimeout(toolkey, 15000);
};


function addEvent(obj,type,fn){
	if(obj.attachEvent){
		obj.attachEvent('on'+type,function(){
			fn.call(obj);
		})
	}else{
		obj.addEventListener(type,fn,false);
	}
}
if(_ua_text){
	var _t = document.getElementById('LR-BUBBLE').style.top;
	window.onscroll = function(){
		document.getElementById('LR-BUBBLE').style.top = parseInt(_t)+(getScrollTop()/getClientHeight())*100 + '%' ;	
	}
}	
	};
	lib.load(loadFunc);/*执行代码*/
})('{{lib}}','{{config}}');


